-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept early args after help command #4518
Conversation
e9dbf30
to
2c508a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
By the way, this is a good step towards #2866, in case you want to work on that next :)
Interesting, I'll check it out ;) |
2c508a3
to
862f09b
Compare
f9aa933
to
3216e56
Compare
Just an idea. Maybe we could use a hack similar to
|
ab50a08
to
6657f30
Compare
I used |
This could work, it is a smaller change I think. I can change to this if you guys think it's better. |
Those should not have to be committed. You should be able to just delete them.
Sounds good to me, thanks. |
Strange, I did this because the CI was failing due to the lack of those snapshots |
Ah, it's the |
eec69d9
to
9b646f4
Compare
Sorry about the delay! I blame it on the travel and week full of meetings. I'll review this now. |
9b646f4
to
58a86a2
Compare
58a86a2
to
1591c1b
Compare
1591c1b
to
8439e07
Compare
8439e07
to
e7473b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current state looks good to me, thanks!
e7473b1
to
3448b80
Compare
The value_name is not necessary for boolean flags.
fbdb6e7
to
f00d7a5
Compare
The default clap's help command doesn't have the ability to accept flags (e.g --no-pager). The recommended way[1] to solve this is to manually implement it. [1]: clap-rs/clap#5332 Fixes: martinvonz#4501
f00d7a5
to
2844cec
Compare
Can I merge this? |
I think this may have broken If there is no easy fix, that's probably OK. If there is, it might be worth fixing. (I haven't read the long discussion in here yet, so I don't know if it was already discussed) I'm used to this working from other clap programs, I don't know how many people would feel this way. OTOH, it shouldn't be that hard to get used to it. Update: I see it in the changelog, so I'm guessing it was discussed. So, never mind, I'll post something else if I have more thoughts. |
I'll also add a reference to a slightly more problematic bug (IMO), #4746. Yuya pointed me to read the discussion here for that; I have not done that yet, but I'm guessing there might not be an easy fix for that. Update: I just realized this PR is what made it possible for |
Another problem is that I'm not sure whether to promote this to its own issue as a bug/regression. I do like |
Yeah, it was discussed, here is the discussion: |
Good catch! For me, it is a regression. Another way to solve this would be to list all the possible commands to show help with value_parser (like it was suggested by @yuja on #4630 (comment)). |
Maybe we could make the help flags boolean flags that call the new help command if they are present? |
I guess it can't handle multi-level subcommands? I think dynamic completion is the way to go. Maybe we could also cheat that clap's help command exists only in "util completion", but that would disable completion for "help -k ".
I don't know if clap's |
I am still not up to date on exactly how messy different workarounds are, and whether this can be fixed in For example, in my mind, it is more serious than the issue of tab-completing help, which is inconvenient but is not confusing to beginners.
I think it'd be OK if we taught people about it. For example, we could say in the beginning or end of the help text: $ jj rebase --help --no-pager -d abracadabra
Warning. the following arguments were ignored: `--no-pager -d abracadabra`.
<Normal help text follows> This would address the beginner problem (people would still be able to learn that the order of arguments is meant to be irrelevant, since they see jj warn them in the exceptional cases when it is relevant), but it feels a bit too annoying in general. So, I think making the order irrelevant would be better (if possible). |
Checklist
If applicable:
CHANGELOG.md